/**
 **************************************************************************************************************************
 * 
 **************************************************************************************************************************
 * @file RBEffectVariable.h
 **************************************************************************************************************************/

#pragma once

#ifdef  HEADER_MSG
#pragma HEADER_MSG(RBEffectVariable.h)
#endif


/**************************************************************************************************************************
 * Includes
 **************************************************************************************************************************/
#include "RBMain/RBCommon.h"

/**************************************************************************************************************************
 * Forward declarations
 **************************************************************************************************************************/


/**************************************************************************************************************************
 * Classes
 **************************************************************************************************************************/
enum EVariableSemantic
{
    EVS_MATERIAL = 0,       // Parameter will be searched in the material, by its name
    EVS_GEOMETRY,           // Parameter will be searched in the geometry, by its name
    EVS_GLOBAL,             // Parameter will be searched in the global list, by its name
    EVS_PREDIFINED,         // Parameter is predifined
    EVS_LAST = 3            // Force it to be 3 in order to stay in 2 bits
};

enum EVariableType
{
    EVT_VOID        = 1<<0,
    EVT_BOOL        = 1<<1,
    EVT_INT         = 1<<2,
    EVT_FLOAT       = 1<<3,
    EVT_STRING      = 1<<4,
    EVT_TEXTURE     = 1<<5,
    EVT_TEXTURE1D   = 1<<6,
    EVT_TEXTURE2D   = 1<<7,
    EVT_TEXTURE3D   = 1<<8,
    EVT_TEXTURECUBE = 1<<9,
    EVT_SAMPLER     = 1<<10,
/*
    EVT_PIXELSHADER = 15,
    EVT_VERTEXSHADER = 16,
    EVT_UINT = 19,
    EVT_UINT8 = 20,
    EVT_GEOMETRYSHADER = 21,
    EVT_RASTERIZER = 22,
    EVT_DEPTHSTENCIL = 23,
    EVT_BLEND = 24,
    EVT_BUFFER = 25,
    EVT_CBUFFER = 26,
    EVT_TBUFFER = 27,
    EVT_TEXTURE1DARRAY = 28,
    EVT_TEXTURE2DARRAY = 29,
    EVT_RENDERTARGETVIEW = 30,
    EVT_DEPTHSTENCILVIEW = 31,

    EVT_TEXTURE2DMS = 32,
    EVT_TEXTURE2DMSARRAY = 33,

    EVT_TEXTURECUBEARRAY = 34,

    EVT_HULLSHADER = 35,
    EVT_DOMAINSHADER = 36,

    EVT_INTERFACE_POINTER = 37,
    EVT_COMPUTESHADER = 38,

    EVT_DOUBLE = 39,
*/

    // force 32-bit size enum
    EVT_FORCE_DWORD = 0x7fffffff
};


enum EVariablePredifined
{
    EVS_PROJ = EVS_LAST+1,
    EVS_INVPROJ,
    EVS_VIEW,
    EVS_INVVIEW,
    EVS_WORLD,
    EVS_INVWORLD,
    EVS_WORLDVIEW,
    EVS_INVWORLDVIEW,
    EVS_VIEWPROJ,
    EVS_INVVIEWPROJ,
    EVS_WORLDVIEWPROJ,
    EVS_INVWORLDVIEWPROJ,
    // Materials
    EVS_MATERIAL_DIFFUSE,
    EVS_MATERIAL_AMBIENT,
    EVS_MATERIAL_SPECULAR,
    EVS_MATERIAL_EMISSIVE,
    EVS_MATERIAL_POWER,
    EVS_MATERIAL_TEXTURE,
    // Eye
    EVS_EYE_POS, // World space
    EVS_EYE_DIR, // World space
    // Frustum
    EVS_CAMERA_FRUSTUM,
    // Constants
    EVS_TIME,
    EVS_SINTIME,
    EVS_COSTIME,
    EVS_TANTIME,
    EVS_TIME_SINTIME_COSTIME_TANTIME
};

struct RBEffectCBVariable
{
    RBStringID   Name;
    uint32       Semantic;
    uint16       Offset;
    uint16       Size;
};

struct RBEffectRVVariable
{
    uint32       Semantic;
    RBStringID   Name;
};

struct RBEffectSamplerVariable
{
    uint32       Semantic;
    RBStringID   Name;
};

struct RBShaderConstantBufferVariable
{
    uint32       EffectBufferOffset;
    uint16       ConstantBufferOffset;
    uint16       Size;
};

struct RBShaderResourceViewVariable
{
    uint32       EffectViewIndex;
    uint32       BindPoint;
};

struct RBShaderSamplerVariable
{
    uint32       EffectViewIndex;
    uint32       BindPoint;
};
